﻿using System;
using System.Collections.Generic;
using UnityEngine;
using KEngine;

namespace DashFire
{
  class ShadersCache
  {
    private static readonly Dictionary<string, Shader> sCache = new Dictionary<string, Shader>();

    public static Shader FindShader(string shaderName)
    {
      Shader shader;
      if (!sCache.TryGetValue(shaderName, out shader))
      {
        shader = Shader.Find(shaderName);
        sCache[shaderName] = shader;
        if (shader == null)
          Log.Error("缺少Shader：{0}  ， 检查Graphics Settings的预置shader", shaderName);
      }

      return shader;
    }
  }
}
